//
//  AddGoodsTableViewCell.m
//  Mall
//
//  Created by 孙飞燕 on 16/10/11.
//  Copyright © 2016年 孙飞燕. All rights reserved.
//

#import "AddGoodsTableViewCell.h"
#import "GoodsModel.h"
@implementation AddGoodsTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.reduceBtn.tag = 11;
    self.addBtn.tag = 12;
//    GoodsModel *model = [[GoodsModel alloc]init];
//    self.numberTF.text = [NSString stringWithFormat:@"%d",model.goodsNumber];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


//减少商品数量的按钮
- (IBAction)reduceBtn:(UIButton *)sender {
    if (YES) {
        if ([self.delegate respondsToSelector:@selector(addGoodsTableViewCellDelegateForGoodsCount:andFlag:)]) {

            [self.delegate addGoodsTableViewCellDelegateForGoodsCount:self andFlag:(int)sender.tag];
            
            
        }
    }



}

//增加商品数量的按钮
- (IBAction)addBtn:(UIButton *)sender {
    if (YES) {
        if ([self.delegate respondsToSelector:@selector(addGoodsTableViewCellDelegateForGoodsCount:andFlag:)]) {

            [self.delegate addGoodsTableViewCellDelegateForGoodsCount:self andFlag:(int)sender.tag];
        }
    }

}

/**
 *  监听数量文本框  编辑完成时调用
 */
//- (void)textFieldDidEndEditing:(UITextField *)textField
//{
//    self.numberTF = textField;
//    if (self.numberTF.text.intValue < 0)
//    {
//        self.numberTF.text = @"1";
//    }
//    if(self.numberTF.text.intValue > 99)
//    {
//        self.numberTF.text = @"99";
//        self.addBtn.enabled = NO;
//    }
//    if(self.numberTF.text.intValue == 1)
//    {
//        self.reduceBtn.enabled = NO;
//    }
//    self.chooseCount = self.numberTF.text.intValue;
//}

@end
